import api from "@/api";
import { PORT } from "../config/servicePort";

/**
 * 获取表格数据
 */
export async function getTableData(params: any): Promise<any> {
	return await api.get(`${PORT}/Orders/getList`, params);
}

/**
 * 获取订单状态
 */
export async function getOrderStatus(params: any): Promise<any> {
	return await api.get(`${PORT}/Orders/getStatusList`, params);
}

/**
 * 获取订单详情
 */
export async function getOrderDetail(params: any): Promise<any> {
	return await api.get(`${PORT}/Orders/getOrderInfo`, params);
}

/**
 * 获取物流公司列表
 */
export async function getLogisticsCompanyList(params?: any): Promise<any> {
	return await api.get(`${PORT}/Wx/getExpressList`, params);
}

/**
 * 新增/编辑发货地址信息
 */
export async function saveDeliverAddress(params: any): Promise<any> {
	return await api.post(`${PORT}/Orders/editSender`, params);
}

/**
 * 新增/编辑退货地址信息
 */
export async function saveReturnAddress(params: any): Promise<any> {
	return await api.post(`${PORT}/Orders/editReturn`, params);
}

/**
 * 发货api接口
 */
export async function deliverGoodsApi(params: any): Promise<any> {
	return await api.post(`${PORT}/Orders/deliver`, params);
}

/**
 * 订单售后审核通过
 */
export async function orderAfterSaleAgreeApi(params: any): Promise<any> {
	return await api.post(`${PORT}/OrderSaftersales/aftersalesIsPass`, params);
}

/**
 * 订单售后审核拒绝
 */
export async function orderAfterSaleRefuseApi(params: any): Promise<any> {
	return await api.post(`${PORT}/OrderSaftersales/aftersalesIsRefuse`, params);
}

/**
 * 退款接口
 */
export async function refundMoneyApi(params: any): Promise<any> {
	return await api.post(`${PORT}/OrderSaftersales/aftersalesIsEnd`, params);
}

/**
 * 获取物流list
 */
export async function getLogisticsCompanyAndIconList(type?: any): Promise<any> {
	return await api.get(`${PORT}/Wx/getAllExpressAccount`, { is_cash: type });
}

// 在线发货api
export async function onLineDeliverGoodsApi(params: any): Promise<any> {
	return await api.post(`${PORT}/Orders/onLineDeliver`, params);
}

/**
 * 获取物流信息
 */
export async function getLogisticsInfo(params: any): Promise<any> {
	return await api.get(`${PORT}/wx/getLogistic`, params);
}

/**
 * 获取订单备注
 */
export async function getAdminRemark(params: any): Promise<any> {
	return await api.get(`${PORT}/OrderAdminRemark/getList`, params);
}

/**
 * 删除订单备注
 */
export async function deleteAdminRemark(params: any): Promise<any> {
	return await api.post(`${PORT}/OrderAdminRemark/del`, params);
}

/**
 * 添加订单备注
 */
export async function addAdminRemark(params: any): Promise<any> {
	return await api.post(`${PORT}/OrderAdminRemark/add`, params);
}

/**
 * 添加订单备注
 */
export async function editAdminRemark(params: any): Promise<any> {
	return await api.post(`${PORT}/OrderAdminRemark/edit`, params);
}
